<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<%
	String contextPath = request.getContextPath();
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>企业注册</title>
<link href="<%=contextPath%>/css/css1.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="<%=contextPath%>/js/checkUtil.js"></script>
<script src="<%=contextPath%>/im/js/prototype.js" type="text/javascript"></script>
<script src="<%=contextPath%>/im/js/xhconn.js" type="text/javascript"></script>
<script src="<%=contextPath%>/im/js/json.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript">

 function changeStyle(elementID,toStyle) {
  document.getElementById(elementID).className=toStyle;
 }
 var pingTo = "<%=contextPath%>/imEnterpriseService.do";
 var validateName = "0";
 function regIMEn(){
 	var _en = $("enterpriseName").value;
    if(!isID(_en)){
    	alert("企业登录名不符合规则.");
    	return false;
    }
    var _enInfo = $("enterpriseInfo").value;
    if(_enInfo.realLength < 1 || _enInfo.realLeagth > 400){
    	alert("企业简介最多为200个汉字.");
    	return false;
    }
    if($("password").value.realLength < 1){
    	alert("密码不能为空.");
    	return false;
    }
    if($("enterpriseTel").value.realLength < 1){
    	alert("企业电话不能为空.");
    	return false;
    }
    var _tel = $("enterpriseTel").value;
    if(!isTel(_tel) && !isMobil(_tel)){
    	alert("电话不符合规则.");
    	return false;
    }
    if($("enterpriseAddress").value.realLength < 1){
    	alert("企业地址不能为空.");
    	return false;
    }
    if($("enterpriseRelation").value.realLength < 1){
    	alert("企业联系人不能为空.");
    	return false;
    } 
    if($("enterpriseRealName").value.realLength < 1){
    	alert("企业名称不能为空.");
    	return false;
    } 
 	var regBtn = $("subReg");
 	regBtn.onclick = function (){};
 	var _timeN = $("enterpriseName").value;
 	if(_timeN.realLength < 4){
 		alert("企业登录名最少为4个字符。");
 		return false;
 	}
 	var xhConn = new XHConn();
 	xhConn.connect(pingTo,"POST","call=reg&action=validateIME&enterpriseName="+_timeN,
 		function(xh){
 			if(xh.responseText.realLength < 1){
 				alert("用户名校验错误，请与站长联系。");
 			}else{
 				var responseJ = xh.responseText.parseJSON();
 				var uinfo = responseJ.userinfo;
 				var validateValue = uinfo.validate;
 				if(validateValue == "1"){
 				    $("enterpriseIntro").value = $("enterpriseInfo").value+"verylady"+$("enterpriseRelation").value+"verylady"+$("enterpriseTel").value+"verylady"+$("enterpriseAddress").value;
 					$("regForm").action="<%=contextPath%>/imEnterpriseService.do?action=regIME";
 					$("regForm").submit();
 				}else{
 					alert("该企业登录名已经存在。");
 					return false;
 				}
 			}
 		}
 	);
 	regBtn.onclick= function (){ regIMEn(); return false};
 }
</script>
<style>
body {
   margin: 0px;
   padding: 0px;	
   background-position: center center;
   background-repeat: no-repeat;
   background-attachment: fixed;
   width: 100%;
}
</style>
</head>

<body>
<form action="<%=contextPath%>/imService.do?action=regIME" method="POST" name="regForm">
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
  	<td align='center'><span class="font1"><strong>---晓春在线即时通讯企业注册</strong></span></td>
  </tr>
  <tr>
    <td><hr size="3" noshade style="color:#FCD4D2"></td>
  </tr>
</table>
<table width="750" border="0" align="center" cellpadding="8" cellspacing="0">
  
  <tr>
    <td colspan="3"><span class="font1"><strong>填写注册信息</strong></span>(带<span class="font2">*</span>的为必填项)
    </td>
  </tr>
  <tr>
    <td width="170"><div align="right">企业登录名:<span class="font2">*</span></div></td>
    <td width="180">
      <input type="text" name="enterpriseName" class="input1" onfocus="changeStyle('usernameMsg','msg2');" onblur="changeStyle('usernameMsg','msg1');" size="30" maxlength="20"/>
    </td>
    <td width="370"><div class="msg1" id="usernameMsg">3-20个字符(包括英文字母、数字和下划线，不能使用中文)，一旦注册成功用户名不能更改。</div></td>
  </tr>
  <tr>
    <td><div align="right">企业名称:<span class="font2">*</span></div></td>
    <td>
      <input type="text" name="enterpriseRealName" class="input1" onfocus="changeStyle('nicknameMsg','msg2');" onblur="changeStyle('nicknameMsg','msg1');" size="30" maxlength="20"/>
    </td>
    <td><div class="msg1" id="nicknameMsg">3-20个字。</div></td>
  </tr> 
  <tr>
    <td><div align="right">密码:<span class="font2">*</span></div></td>
    <td>
      <input type="password" name="password" class="input1" onfocus="changeStyle('passwdMsg','msg2');" onblur="changeStyle('passwdMsg','msg1')" size="30" maxlength="20"/>
    </td>
    <td><div class="msg1" id="passwdMsg">密码由6-20个字符组成，为保证安全请使用英文字母加数字或符号的组合密码。</div></td>
  </tr>
  <tr>
    <td><div align="right">再输入一遍密码:<span class="font2">*</span></div></td>
    <td>
      <input type="password" name="rePasswd" class="input1" onfocus="changeStyle('passwdreMsg','msg2');" onblur="changeStyle('passwdreMsg','msg1');" size="30" maxlength="20"/>
    </td>
    <td><div class="msg1" id="passwdreMsg">请再输入一遍您上面输入的密码。</div></td>
  </tr>
  <tr>
    <td><div align="right">企业电话:<span class="font2">*</span></div></td>
    <td>
      <input type="text" name="enterpriseTel" class="input1"  size="30" maxlength="50"/>
    </td>
    <td><div class="msg1" id="questionMsg"></div></td>
  </tr>
  <tr>
    <td><div align="right">企业地址:<span class="font2">*</span></div></td>
    <td>
      <input type="text" name="enterpriseAddress" class="input1"  size="30" maxlength="50"/>
    </td>
    <td><div class="msg1" id="answerMsg"></div></td>
  </tr>
  <tr>
    <td><div align="right">企业联系人:<span class="font2">*</span></div></td>
    <td>
      <input type="text" name="enterpriseRelation" class="input1" size="30" maxlength="50"/>
    </td>
    <td><div class="msg1" id="answerMsg"></div></td>
  </tr>
    <td><div align="right">企业简介:<span class="font2">*</span></div></td>
    <td>
      <textarea name="enterpriseInfo" class="input1" style="width:210px;height:100px;"></textarea>
    </td>
    <td><div class="msg1" id="answerMsg"></div></td>
  </tr>
  <tr>
    <td><input type="hidden" name="enterpriseIntro">&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3"><div align="center">
      <input type="button" id="subReg" name="subReg" value="提交注册信息" styleClass="button1" onclick="regIMEn()">
    </div></td>
    </tr> 
</table>
</form>
</body>
</html>